#ifndef GAMEWINDOW_H
#define GAMEWINDOW_H

#include <QWidget>
#include<QSound>
#include"Item.h"
#include "qmap.h"

namespace Ui {
class gamewindow;
}

#define CHESS_ROWS          15
#define CHESS_COLUMES       15
#define RECT_WIDTH          25
#define RECT_HEIGHT         25
class gamewindow : public QWidget
{
    Q_OBJECT

public:
    explicit gamewindow(QWidget *parent = 0);
    ~gamewindow();
    int limit_time;//落子限制时间，秒
    int temp_time;//实时倒计时时间，秒
    QTimer *timer;
    int count=0;

protected:
    void paintEvent(QPaintEvent*e);
    void mousePressEvent(QMouseEvent *);

private:
    void DrawChessboard();//绘制棋盘
    void DrawItems();//绘制棋子
    void DrawItemWithMouse();//棋子跟随鼠标移动
    void DrawChessAtPoint(QPainter& painter,QPoint& pt);//在规定坐标上落子
    int CountItems(item Item,QPoint ptDirection);//判断胜利条件
private:
    Ui::gamewindow *ui;

    QVector<item>mItems;
    bool mIsBlackTurn;
    int mIsWhichBg;
    QString BLACK;
    QString WHITE;
    QString str;

private slots:
    bool countdown();//时间到return true
    void on_pushButton_clicked();
    void on_pushButton_2_clicked();
    void on_pushButton_3_clicked();
};

#endif // GAMEWINDOW_H
